import QtQuick 1.0
import "../Commons"

Rectangle {
    property bool bas : false
    property bool haut : false 
    property bool gauche : false
    property bool droit : false
    property bool maximize : true
    property bool minimize : false
    property bool close : false
    property bool winSwitch : false
    property bool barreVert : false
    
    height: 100
    width:120
    color:'transparent'
    border{color:activeFocus?setting.color1:setting.color2;width:4}
    radius:4
    Settings{
      id: setting
    }
    
    
    //gauche , droit
    Rectangle {
	height:parent.height
	width:parent.width/2
	anchors.left:gauche?parent.left:undefined
	anchors.right:droit?parent.right:undefined
	visible:gauche||droit
	border.color: parent.border.color
	border.width: parent.border.width
	color: setting.color2
	radius:parent.radius
    }
    
    //haut , bas
    Rectangle {
	height:parent.height/2
	width:parent.width
	anchors.top:haut?parent.top:undefined
	anchors.bottom:bas?parent.bottom:undefined
	visible:haut||bas
	border.color: parent.border.color
	border.width: parent.border.width
	color: setting.color2
	radius:parent.radius
    }
    
    
    //maximize
    Rectangle {
	height:parent.height -20
	width:parent.width -20
	anchors.centerIn:parent
	visible:maximize
	border.color: parent.border.color
	border.width: parent.border.width
	color: setting.color2
	radius:parent.radius
    }
  
    //minimize
    Rectangle {
	height:10
	width:2*parent.width/3
	anchors.centerIn:parent
	visible:minimize
	border.color: parent.border.color
	border.width: parent.border.width
	color: setting.color2
	radius:parent.radius
    }
    
    //close
    Rectangle {
	height:10
	width:2*parent.width/3
	anchors.centerIn:parent
	visible:close
	rotation:45
	border.color: parent.border.color
	border.width: parent.border.width
	color: setting.color2
	radius:parent.radius
    }
    Rectangle {
	height:10
	width:2*parent.width/3
	anchors.centerIn:parent
	visible:close
	rotation:135
	border.color: parent.border.color
	border.width: parent.border.width
	color: setting.color2
	radius:parent.radius
    }
    
    //winSwitch
    Rectangle {
	id:petitrec1
	height:parent.height/3
	width:parent.width/3 - 10
	anchors.left:parent.left
	anchors.verticalCenter:parent.verticalCenter
	anchors.margins:7
	visible:winSwitch
	border.color: parent.border.color
	border.width: parent.border.width
	color: setting.color2
	radius:parent.radius
    }
    Rectangle {
	id:petitrec2
	height:parent.height/3
	width:parent.width/3 - 10
	anchors.left:petitrec1.right
	anchors.verticalCenter:parent.verticalCenter
	anchors.margins:7
	visible:winSwitch
	border.color: parent.border.color
	border.width: parent.border.width
	color: setting.color2
	radius:parent.radius
    }
    Rectangle {
	id:petitrec3
	height:parent.height/3
	width:parent.width/3 - 10
	anchors.left:petitrec2.right
	anchors.verticalCenter:parent.verticalCenter
	anchors.margins:7
	visible:winSwitch
	border.color: parent.border.color
	border.width: parent.border.width
	color: setting.color2
	radius:parent.radius
    }
    
    //barreVert
    Rectangle {
	id:recVert1
	height:parent.height/3 -10
	width:parent.width/3
	anchors.top:parent.top
	anchors.horizontalCenter:parent.horizontalCenter
	anchors.margins:7
	visible:barreVert
	border.color: parent.border.color
	border.width: parent.border.width
	color: setting.color2
	radius:parent.radius
    }
    Rectangle {
	id:recVert2
	height:parent.height/3 - 10
	width:parent.width/3 
	anchors.top:recVert1.bottom
	anchors.horizontalCenter:parent.horizontalCenter
	anchors.margins:7
	visible:barreVert
	border.color: parent.border.color
	border.width: parent.border.width
	color: setting.color2
	radius:parent.radius
    }
    Rectangle {
	height:parent.height/3 - 10
	width:parent.width/3 
	anchors.top:recVert2.bottom
	anchors.horizontalCenter:parent.horizontalCenter
	anchors.margins:7
	visible:barreVert
	border.color: parent.border.color
	border.width: parent.border.width
	color: setting.color2
	radius:parent.radius
    }
    
}
   
    
 /*   
    Connections {
      target: stdin
      onInputLine : {
	console.log('=======****'+inputLine);
	//actListRect.focus=true;
      }
      onShow : {
	console.log('=====onShow==****');
	actListRect.focus=true;
      }
    }
    
    Connections {
      target: qmlviewer
      onFocusOut : {
	qmlviewer.hide();
      }
      onShow : {
	console.log('=====onShow=----=****');
      }
    }
    
    Rectangle {
	  id: actListRect
	  height: 180
	  width:700
	  Rectangle {
	    anchors.fill:parent
	    border{color:setting.color1;width:4}
	    color: setting.backgroundColor
	    radius:4
	    opacity: 0.5
	  }
	  focus: true
	  color: 'transparent'
	  anchors.centerIn:parent
	  smooth: true
	  ListView {
		  id: listVModel1
		  height: parent.height - 50
		  width: parent.width - 40
		  anchors.centerIn: parent
		  focus: true
		  model:actVModel1
		  orientation : ListView.Horizontal
		  spacing : 35
		  delegate: Rectangle {
				  id:rectItem
				  smooth: true
				  color:'transparent'
				  width: 80
				  height: 80
				  radius: 5
				  border.color:setting.color2
				  border.width: activeFocus?5:0
				  //focus: true
				  Image {
					id:imgVid
					anchors.fill:rectItem
					fillMode: Image.PreserveAspectFit
					source: src
					smooth: true
				  }
				  states: State {
					name: "active"; when: rectItem.activeFocus
					PropertyChanges { target: rectItem
							  scale: 1.2
					}
				    }

				    transitions: Transition {
					NumberAnimation { properties: "scale"; duration: 100 }
				    }
				  
				  //handle events here
				  Keys.onReturnPressed : {
				    console.log('<'+elt+'> pressed');
				    //ex:xdotool key ctrl+super+Right
				      action.execAndExit(elt);
				  }  
				}
		  
	      }
	      
    }
        
    
}
 */
